package com.xn.app.muying.util;

import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v7.app.AppCompatActivity;

import com.xn.app.muying.BroadcastReceiver.NotificationReceiver;
import com.xn.app.muying.R;

import cn.jiguang.share.android.api.JShareInterface;

/**
 * activity基类
 * Created by gaoge on 2017/1/9.
 */

public abstract class BaseActivity extends AppCompatActivity{


    @Override
    protected void onCreate( Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    /**
     * 固定字体
     * @return
     */
    @Override
    public Resources getResources() {
        Resources res = super.getResources();
        Configuration config = new Configuration();
        config.setToDefaults();
        res.updateConfiguration(config, res.getDisplayMetrics());
        return res;
    }

    @Override
    public void finish() {
        super.finish();
        overridePendingTransition(R.anim.back_lift_exit, R.anim.back_right_enter);
    }

    @Override
    public void startActivity(Intent intent) {
        super.startActivity(intent);
        overridePendingTransition(R.anim.in_lift_exit, R.anim.in_right_enter);
    }

    /**
     * 注册通知广播
     */
    public void registerBoradcastReceiver(){
        IntentFilter myIntentFilter = new IntentFilter();
        myIntentFilter.addAction(AppConstant.MY_ACTION);
        //注册广播
        registerReceiver(new NotificationReceiver(), myIntentFilter);
    }
}
